<template>
  <div class="t-detail">
      <div class="s-top">
        <div class="t-type">
          <div :class="{'bg_blue':detailData.category == 1 || detailData.category == 2,'bg_yellow': detailData.category == 0 || detailData.category == 3}">{{words[detailData.category]}}</div>
          <p>{{detailData.infoOrder}}</p>
        </div>
        <div class="t-number dinpro">{{((detailData.category == 1 || detailData.category == 2)?"+":"-")+detailData.moneyOrder }}</div>
        <div class="t-status">{{ statusOrder[detailData.statusOrder] }}</div>
      </div>
      <div class="t-list pb-40" v-show="detailData.category !== 2">
        <div class="left">{{ detailData.category == 3?"提现到":"付款方式"  }}</div>
        <div class="right">{{ detailData.bankCardNo != ""?(detailData.bankName+(detailData.bankCardNo)):detailData.infoOrder }}</div>
      </div>
      <i/>
      <div class="t-list mt-40">
        <div class="left">交易时间</div>
        <div class="right">{{ detailData.createTime }}</div>
      </div>
      <div class="t-list mt-40">
        <div class="left">交易订单号</div>
        <div class="right">{{ detailData.noOrder }}</div>
      </div>
  </div>
</template>
<script>
export default {
  name: "tradeinfo",
  data() {
    return {
      sessionid: "",
      words: ["投", "充", "回", "提"],
      orderNo: "",
      detailData: {
        category: 1,
        noOrder: "",
        nameGoods: "",
        infoOrder: "",
        createTime: "",
        moneyOrder: "0.00",
        statusOrder: "0",
        statusOrderName: "",
        bankName: "",
        bankCardNo: ""
      },
      statusOrder: []
    };
  },
  created() {
    if (this.Uitis.isClient) {
      var UserInfo = APP.getInfo();
      UserInfo.then(res => {
        if (res.uId !== "") {
          this.sessionid = res.sessionid;
          this.orderNo = this.Uitis.GetLocationParams("noOrder");
          this.init();
        } else {
          this.Uitis.JumpNavite("jumpToLogin");
        }
      });
    } else {
      this.sessionid = localStorage.getItem("sessionid");
      if (this.sessionid !== null && this.sessionid !== "") {
        this.orderNo = this.Uitis.GetLocationParams("noOrder");
        this.init();
      } else {
        // window.location.href = `${this.Interface.wabapp}login`;
      }
    }
  },
  methods: {
    init() {
      var req = this.$http.get(this.Interface.getOrderDetail, {
        params: {
          sessionid: this.sessionid,
          orderNo: this.orderNo
        }
      });
      req.then(res => {
        var result = res.data;
        if (result.success) {
          this.detailData = result.data;
          if (result.data.category == 3) {
            this.statusOrder = [
              "审核中",
              "交易成功",
              "提现中",
              "退款",
              "交易失败"
            ];
          } else {
            this.statusOrder = [
              "待付款",
              "交易成功",
              "处理中",
              "退款",
              "交易失败"
            ];
          }
        }
      });
    }
  }
};
</script>
<style lang="less">
.t-detail {
  background: #fff;
  height: 100%;
  .s-top {
    padding: 80px 0 120px;
    text-align: center;
    .t-type {
      font-size: 34px;
      color: #333;
      display: flex;
      align-items: center;
      justify-content: center;
      div {
        font-size: 28px;
        color: #fff;
        width: 48px;
        height: 48px;
        line-height: 48px;
        border-radius: 50%;
        // transform: rotate(180deg);
        margin-right: 20px;
        &.bg_blue {
          background: #5260f8;
        }
        &.bg_yellow {
          background: #e6b673;
        }
      }
    }
    .t-number {
      margin-top: 40px;
      font-size: 63px;
      color: #333;
    }
    .t-status {
      margin-top: 30px;
      font-size: 28px;
      color: #999;
    }
  }
  .t-list {
    margin: 0 42px;
    display: flex;
    justify-content: space-between;
    font-size: 28px;
    flex-wrap: wrap;
    .left {
      color: #666;
    }
    .right {
      color: #333;
    }
  }
  .pb-40 {
    padding-bottom: 40px;
    border-bottom: 1px solid #f3f3f3;
  }
  .mt-40 {
    margin-top: 40px;
  }
}
</style>